import {
  addComponent,
  addComponentsDir,
  addImports,
  addImportsSources,
  addPlugin,
  createResolver,
  defineNuxtModule,
  extendPages,
} from '@nuxt/kit'

export default defineNuxtModule({
  setup() {
    const resolver = createResolver(import.meta.url)
    addPlugin({
      src: resolver.resolve('runtime/plugin'),
      mode: 'client',
    })
    extendPages((pages) => {
      pages.push({
        path: '/subapp/:pathMatch(.*)*',
        file: resolver.resolve('./VueSubApp.vue'),
        // children: [
        //   {
        //     path: '*',
        //     file: resolver.resolve('./VueSubApp.vue'),
        //     // file: resolver.resolve('./VueSubApp.vue'),
        //   },
        // ],
      })
      console.log(pages)
    })
  },
})
